//引入createApp用于创建应用
import { createApp } from "vue";
//引入App根组件
import App from "./App.vue";
//引入加载路由器
import router from "./router";
import Hello from "@/pages/SuspenseDemo/Hello.vue";

//第一步：引入pinia
import { createPinia } from "pinia";
//第二步：创建pinia实例
const pinia = createPinia();

//创建应用
const app = createApp(App);
app.component("Hello", Hello);
app.config.globalProperties.$message = "测试全局属性";
app.directive(
  "beauty",
  (
    element: {
      innerText: any;
      style: { color: string; backgroundColor: string };
    },
    { value }: any
  ) => {
    element.innerText += value;
    element.style.color = "red";
    element.style.backgroundColor = "yellow";
  }
);
//挂载路由器
app.use(router);
//第三步：挂载pinia
app.use(pinia);
//挂载应用到app容器中
app.mount("#app");
